/****** Object:  Stored Procedure dbo.spr_InsertDBCars  ******/

 use [TourIS]
 GO

 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spr_InsertDBCars]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 drop procedure [dbo].[spr_InsertDBCars]
 GO

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS OFF
 GO

 CREATE  PROCEDURE [dbo].[spr_InsertDBCars]
 (
	@carid int,
	@compid int,
	@details varchar(80),
	@garagevisitreading varchar(15),
	@is3rdparty bit,
	@isactive bit,
	@isauto bit,
	@lastgaragevisit smalldatetime,
	@lastoilchecked smalldatetime,
	@lasttyrechange smalldatetime,
	@make varchar(50),
	@model varchar(50),
	@oilchangereading varchar(15),
	@purchasedate smalldatetime,
	@regno varchar(20),
	@tyrechangereading varchar(15)
 )
 AS

 BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	INSERT INTO [Cars]
	(
		[CarId],
		[CompId],
		[Details],
		[GarageVisitReading],
		[Is3rdParty],
		[IsActive],
		[IsAuto],
		[LastGarageVisit],
		[LastOilChecked],
		[LastTyreChange],
		[Make],
		[Model],
		[OilChangeReading],
		[PurchaseDate],
		[RegNo],
		[TyreChangeReading]
	)
	VALUES
	(
		@carid,
		@compid,
		@details,
		@garagevisitreading,
		@is3rdparty,
		@isactive,
		@isauto,
		@lastgaragevisit,
		@lastoilchecked,
		@lasttyrechange,
		@make,
		@model,
		@oilchangereading,
		@purchasedate,
		@regno,
		@tyrechangereading
	)

	SET @Err = @@Error
	RETURN @Err
 END

 GO

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS ON
 GO

